package br.com.controller;

import java.sql.Connection;
import java.util.List;

import br.com.bean.DisciplinaTurmaBean;
import br.com.bean.NotaFaltaBimestreBean;
import br.com.bean.TurmaBean;
import br.com.dao.NotaFaltaBimestreDao;

public class NotaFaltaBimestralController {

		public static void inserir (Connection conn,  int matr, int bim,  int aulasdadas,  int disc,  double nota,  int falta, int al) throws Exception{

			NotaFaltaBimestreBean bean = new NotaFaltaBimestreBean();
			for(int i=0; i < bean.toString().length(); i++){
				
			bean.getNmatricula().setId(matr);
			bean.getBimestre().setId(bim);
			bean.setAulasdadas(aulasdadas);
			bean.getDisciplina().setId(disc);
			bean.setNota(nota);
			bean.setFalta(falta);
			bean.getAluno().setId(al);

			NotaFaltaBimestreDao dao = new NotaFaltaBimestreDao();
			dao.inserir(conn,bean);
			
			}
		}

		public void alterar (Connection conn, int matr, int bim,  int aulasdadas,  int disc,  double nota,  int falta, int al) throws Exception{

			NotaFaltaBimestreBean bean = new NotaFaltaBimestreBean();
			bean.getNmatricula().setId(matr);
			bean.getBimestre().setId(bim);
			bean.setAulasdadas(aulasdadas);
			bean.getDisciplina().setId(disc);
			bean.setNota(nota);
			bean.setFalta(falta);
			bean.getAluno().setId(al);
			
			NotaFaltaBimestreDao dao = new NotaFaltaBimestreDao();
			dao.inserir(conn,bean);

		}

		public void excluir (Connection conn, int id) throws Exception {

			NotaFaltaBimestreBean bean = new NotaFaltaBimestreBean();
			bean.setId(id);

			NotaFaltaBimestreDao dao = new NotaFaltaBimestreDao();
			dao.inserir(conn,bean);
		}
		
		public static List<NotaFaltaBimestreBean> ListCanhoto(Connection conn, int turma)throws Exception{

			NotaFaltaBimestreDao dao = new NotaFaltaBimestreDao();
			TurmaBean tur = new TurmaBean();
			tur.setId(turma);
			
			List<NotaFaltaBimestreBean> canhoto = dao.getCanhoto(conn, tur);
			
			return canhoto;
		}
		
		public static List<NotaFaltaBimestreBean> ListCanhoto1(Connection conn, int dturma)throws Exception{

			NotaFaltaBimestreDao dao = new NotaFaltaBimestreDao();
			DisciplinaTurmaBean dtur = new DisciplinaTurmaBean();
			dtur.setId(dturma);

			List<NotaFaltaBimestreBean> canhoto = dao.getCanhoto(conn, dtur);
			
			return canhoto;
		}
}
